package com.zhbcm.outupload.common.response;

/**
 * @Author: 朝花不迟暮
 * @Date: 2021/12/23 22:28
 * @Description:
 */
public class ResultUtil {
    public static ApiResult success(Object object) {
        ApiResult apiResult = new ApiResult();
        apiResult.setCode(CustomResponse.SUCCESS.getCode());
        apiResult.setMsg(CustomResponse.SUCCESS.getMsg());
        apiResult.setData(object);
        return apiResult;
    }

    public static ApiResult success() {
        ApiResult apiResult = new ApiResult();
        apiResult.setCode(CustomResponse.SUCCESS.getCode());
        apiResult.setMsg(CustomResponse.SUCCESS.getMsg());
        return apiResult;
    }

    public static ApiResult success(Integer code, String msg, Object obj) {
        ApiResult apiResult = new ApiResult();
        apiResult.setCode(code);
        apiResult.setMsg(msg);
        apiResult.setData(obj);
        return apiResult;
    }

    public static ApiResult error(Object object) {
        ApiResult apiResult = new ApiResult();
        apiResult.setCode(CustomResponse.FAILURE.getCode());
        apiResult.setMsg(CustomResponse.FAILURE.getMsg());
        apiResult.setData(object);
        return apiResult;
    }

    public static ApiResult errMsg(String msg) {
        ApiResult apiResult = new ApiResult();
        apiResult.setCode(CustomResponse.FAILURE.getCode());
        apiResult.setMsg(msg);
        return apiResult;
    }

    public static ApiResult error() {
        ApiResult apiResult = new ApiResult();
        apiResult.setCode(CustomResponse.FAILURE.getCode());
        apiResult.setMsg(CustomResponse.FAILURE.getMsg());
        return apiResult;
    }

    public static ApiResult error(Integer code, String msg, Object obj) {
        ApiResult apiResult = new ApiResult();
        apiResult.setCode(code);
        apiResult.setMsg(msg);
        apiResult.setData(obj);
        return apiResult;
    }
}